home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / Macintosh Sample Code / SC.011.GetZoneList / GetZoneList.r < prev    next >
Encoding:
Text File  |  1990-04-30  |  6.6 KB  |  302 lines  |  [TEXT/MPS ]

  1. /*-----------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    AppleTalk GetZoneList Sample Application
  6. #
  7. #    GetZoneList
  8. #
  9. #    GetZoneList.r    -    Rez Source
  10. #
  11. #    Copyright © 1988-1990 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    November 1988
  15. #                1.1                    October 1989
  16. #                1.2                    May 1990
  17. #
  18. #    Components:    GetZoneList.c        May 1, 1990
  19. #                GetZoneList.p        May 1, 1990
  20. #                GetZoneList.r        May 1, 1990
  21. #                MakeFile            May 1, 1990
  22. #                UFailure.a            November 1, 1988
  23. #                UFailure.h            November 1, 1988
  24. #                UFailure.inc1.p        November 1, 1988
  25. #                UFailure.p            November 1, 1988
  26. #
  27. #    GetZoneList is a sample application that uses
  28. #    AppleTalk ATP and ZIP to obtain a list of zones
  29. #    on an AppleTalk internet.
  30. #
  31. #    GetZoneList also demonstrates using a signal, or
  32. #    failure-catching mechanism to recover from error
  33. #    situations.
  34. #
  35. #    GetZoneList is based on DTS Sample.p. For more
  36. #    description and explanantion of the non-example
  37. #    specific areas of this application, please refer to
  38. #    either Sample.p or TESample.p.
  39. #
  40. # -----------------------------------------------------------------------------*/
  41.  
  42. #include "Types.r"
  43.  
  44.  
  45. #define kMinSize    62        /* application's minimum size (in K) */
  46. #define kPrefSize    66        /* application's preferred size (in K) */
  47.  
  48. #define    rAboutAlert    128        /* about alert */
  49. #define rZoneDialog    129        /* zone list dialog */
  50. #define rUserAlert    130        /* error alert */
  51.  
  52. #define    sErrStrings    128        /* error strings STR# ID */
  53.  
  54. #define    rMenuBar    128        /* application's menu bar */
  55.  
  56. #define    mApple        128        /* Apple menu */
  57.  
  58. #define    mFile        129        /* File menu */
  59.  
  60. #define    mEdit        130        /* Edit menu */
  61.  
  62. /* these #defines are used to set enable/disable flags of a menu */
  63.  
  64. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  65. #define NoItems        0b0000000000000000000000000000000
  66. #define MenuItem1    0b0000000000000000000000000000001
  67. #define MenuItem2    0b0000000000000000000000000000010
  68. #define MenuItem3    0b0000000000000000000000000000100
  69. #define MenuItem4    0b0000000000000000000000000001000
  70. #define MenuItem5    0b0000000000000000000000000010000
  71. #define MenuItem6    0b0000000000000000000000000100000
  72. #define MenuItem7    0b0000000000000000000000001000000
  73. #define MenuItem8    0b0000000000000000000000010000000
  74. #define MenuItem9    0b0000000000000000000000100000000
  75. #define MenuItem10    0b0000000000000000000001000000000
  76. #define MenuItem11    0b0000000000000000000010000000000
  77. #define MenuItem12    0b0000000000000000000100000000000
  78.  
  79.  
  80. /* we use an MBAR resource to conveniently load all the menus */
  81.  
  82. resource 'MBAR' (rMenuBar, preload) {
  83.     { mApple, mFile, mEdit };    /* three menus */
  84. };
  85.  
  86.  
  87. resource 'MENU' (mApple, preload) {
  88.     mApple, textMenuProc,
  89.     AllItems & ~MenuItem2,        /* Disable dashed line, enable About and DAs */
  90.     enabled, apple,
  91.     {
  92.         "About GetZoneList…",
  93.             noicon, nokey, nomark, plain;
  94.         "-",
  95.             noicon, nokey, nomark, plain
  96.     }
  97. };
  98.  
  99. resource 'MENU' (mFile, preload) {
  100.     mFile, textMenuProc,
  101.     MenuItem1 | MenuItem12,        /* enable Quit and New only, program enables others */
  102.     enabled, "File",
  103.     {
  104.         "New",
  105.             noicon, "N", nomark, plain;
  106.         "Open",
  107.             noicon, "O", nomark, plain;
  108.         "-",
  109.             noicon, nokey, nomark, plain;
  110.         "Close",
  111.             noicon, "W", nomark, plain;
  112.         "Save",
  113.             noicon, "S", nomark, plain;
  114.         "Save As…",
  115.             noicon, nokey, nomark, plain;
  116.         "Revert",
  117.             noicon, nokey, nomark, plain;
  118.         "-",
  119.             noicon, nokey, nomark, plain;
  120.         "Page Setup…",
  121.             noicon, nokey, nomark, plain;
  122.         "Print…",
  123.             noicon, nokey, nomark, plain;
  124.         "-",
  125.             noicon, nokey, nomark, plain;
  126.         "Quit",
  127.             noicon, "Q", nomark, plain
  128.     }
  129. };
  130.  
  131. resource 'MENU' (mEdit, preload) {
  132.     mEdit, textMenuProc,
  133.     NoItems,                    /* disable everything, program does the enabling */
  134.     enabled, "Edit",
  135.      {
  136.         "Undo",
  137.             noicon, "Z", nomark, plain;
  138.         "-",
  139.             noicon, nokey, nomark, plain;
  140.         "Cut",
  141.             noicon, "X", nomark, plain;
  142.         "Copy",
  143.             noicon, "C", nomark, plain;
  144.         "Paste",
  145.             noicon, "V", nomark, plain;
  146.         "Clear",
  147.             noicon, nokey, nomark, plain
  148.     }
  149. };
  150.  
  151. /* this ALRT and DITL are used as an About screen */
  152.  
  153. resource 'ALRT' (rAboutAlert) {
  154.     {40, 20, 160, 292}, rAboutAlert, {
  155.         OK, visible, silent;
  156.         OK, visible, silent;
  157.         OK, visible, silent;
  158.         OK, visible, silent
  159.     };
  160. };
  161.  
  162. resource 'DITL' (rAboutAlert) {
  163.      {
  164.         {88, 180, 108, 260},
  165.         Button {
  166.             enabled,    "OK"
  167.         };
  168.         {8, 8, 24, 214},
  169.         StaticText {
  170.             disabled,    "GetZoneList"
  171.         };
  172.         {32, 8, 48, 237},
  173.         StaticText {
  174.             disabled,    "© 1989-90 Apple Computer, Inc."
  175.         };
  176.         {56, 8, 72, 136},
  177.         StaticText {
  178.             disabled,    "Brought to you by:"
  179.         };
  180.         {80, 24, 112, 167},
  181.         StaticText {
  182.             disabled,    "Macintosh Developer " $"CA" "Technical Support"
  183.         }
  184.     }
  185. };
  186.  
  187.  
  188. /* this DLOG and DITL are used for the Zone List dialog */
  189.  
  190. resource 'DLOG' (rZoneDialog) {
  191.     {100, 100, 290, 400},
  192.     dBoxProc,
  193.     invisible,
  194.     noGoAway,
  195.     0x0,
  196.     rZoneDialog,
  197.     ""
  198. };
  199.  
  200. resource 'DITL' (rZoneDialog) {
  201.     {
  202.         {160, 220, 180, 280},
  203.         Button {
  204.             enabled,
  205.             "OK"
  206.         },
  207.         {20, 20, 148, 280},
  208.         UserItem {
  209.             enabled
  210.         },
  211.         {160, 220, 180, 280},
  212.         UserItem {
  213.             disabled
  214.         }
  215.     }
  216. };
  217.  
  218.  
  219. /* this ALRT and DITL are used as an error screen */
  220.  
  221. resource 'ALRT' (rUserAlert, purgeable) {
  222.     {40, 20, 180, 260},
  223.     rUserAlert,
  224.     { /* array: 4 elements */
  225.         /* [1] */
  226.         OK, visible, silent,
  227.         /* [2] */
  228.         OK, visible, silent,
  229.         /* [3] */
  230.         OK, visible, silent,
  231.         /* [4] */
  232.         OK, visible, silent
  233.     }
  234. };
  235.  
  236.  
  237. resource 'DITL' (rUserAlert, purgeable) {
  238.     { /* array DITLarray: 4 elements */
  239.         /* [1] */
  240.         {110, 150, 130, 230},
  241.         Button {
  242.             enabled,
  243.             "OK"
  244.         },
  245.         /* [2] */
  246.         {10, 60, 60, 230},
  247.         StaticText {
  248.             disabled,
  249.             "Error. ^0."
  250.         },
  251.         /* [3] */
  252.         {70, 60, 90, 230},
  253.         StaticText {
  254.             disabled,
  255.             "^1"
  256.         },
  257.         /* [4] */
  258.         {8, 8, 40, 40},
  259.         Icon {
  260.             disabled,
  261.             2
  262.         }
  263.     }
  264. };
  265.  
  266.  
  267. resource 'STR#' (sErrStrings, purgeable) {
  268.     {
  269.     "An error occurred. The error number is: ";
  270.     "You must run on 512Ke or later";
  271.     "Application Memory Size is too small";
  272.     "Not enough memory to run GetZoneList";
  273.     "An AppleTalk-related error occurred";
  274.     "There are no zones"
  275.     }
  276. };
  277.  
  278.  
  279. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  280.  
  281. resource 'SIZE' (-1) {
  282.     dontSaveScreen,
  283.     acceptSuspendResumeEvents,
  284.     enableOptionSwitch,
  285.     canBackground,                /* we can background; we don't currently, but our sleep value */
  286.                                 /* guarantees we don't hog the Mac while we are in the background */
  287.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  288.     backgroundAndForeground,    /* this is definitely note a background-only application! */
  289.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  290.     ignoreChildDiedEvents,
  291.     is32BitCompatible,
  292.     reserved,
  293.     reserved,
  294.     reserved,
  295.     reserved,
  296.     reserved,
  297.     reserved,
  298.     reserved,
  299.     kPrefSize * 1024,
  300.     kMinSize * 1024
  301. };
  302.